#pragma once

#include "Log.h"
#include "Common.h"

namespace zmh
{
    class Reactor;

    class Connection
    {
    public:
        uint32_t Events() const { return _events; }
        void SetEvents(uint32_t events) { _events = events; }

        Reactor *Owner() const { return _owner; }
        void SetOwner(Reactor *owner) { _owner = owner; }

        virtual void Recv() = 0;
        virtual void Send() = 0;
        virtual void Except() = 0;
        virtual int GetFd() = 0;

    private:
        uint32_t _events = 0;      // 该连接所关心的事件
        Reactor *_owner = nullptr; // 回指指针->它的管理者-Reactor
    };
}